finding the derivative of a trigonometric function